home *** CD-ROM | disk | FTP | other *** search
- #include <Quickdraw.h>
- #include <Fonts.h>
- #include <Menus.h>
- #include <TextEdit.h>
- #include <Dialogs.h>
- #include <Finder.h>
-
- #include "StandardGetFolder.h"
-
- static pascal Boolean OnlyVisibleFoldersCustomFileFilter(CInfoPBPtr myCInfoPBPtr, Ptr dataPtr)
- {
- #pragma unused (dataPtr)
-
- // return true if this item is invisible or a file
-
- Boolean visibleFlag;
- Boolean folderFlag;
-
- visibleFlag = ! (myCInfoPBPtr->hFileInfo.ioFlFndrInfo.fdFlags & kIsInvisible);
- folderFlag = (myCInfoPBPtr->hFileInfo.ioFlAttrib & 0x10);
-
- // because the semantics of the filter proc are "true means don't show
- // it" we need to invert the result that we return
-
- return !(visibleFlag && folderFlag);
- }
-
-
- void main(void)
- {
- FileFilterYDUPP invisiblesExcludedCustomFilterUPP;
- StandardFileReply mySFReply;
-
- // init the toolbox
-
- InitGraf(&qd.thePort); InitFonts(); InitWindows();
- InitMenus(); TEInit(); InitDialogs(nil); MaxApplZone();
-
- // call the get folder routine, passing in our file filter
-
- invisiblesExcludedCustomFilterUPP = NewFileFilterYDProc(OnlyVisibleFoldersCustomFileFilter);
-
- StandardGetFolder(invisiblesExcludedCustomFilterUPP, &mySFReply);
-
- DisposeRoutineDescriptor(invisiblesExcludedCustomFilterUPP);
-
- // MacsBug is indeed the best UI for reporting results
- /*
- if (mySFReply.sfGood)
- {
- DebugStr(mySFReply.sfFile.name);
-
- if (mySFReply.sfIsVolume) DebugStr("\p is a volume");
- }
- else
- {
- DebugStr("\p cancelled");
- }
- */
- }